
*=======*
*Table 2*
*=======*

*Number of episodes; prop.interactions initiated; Honest trade rate
*Proportions are calculated manually using frequencies derived from the following commands.

*All
tab market if player == 1
tab market if player == 1 & play_or_not == 1
tab market if (player == 1 & play_or_not == 1 & game_type == 1) | (return_new ==1 & game_type >1)

*Move together
tab market if player == 1 & game_type == 1
tab market if player == 1 & play_or_not == 1 & game_type == 1

*Buyer first
tab market if player == 1 & game_type == 3
tab market if player == 1 & play_or_not == 1 & game_type == 3
tab market if second_mover == 1 & play_or_not == 1 & return_new ==1 & game_type == 3

*Owner first
tab market if player == 1 & game_type == 2
tab market if player == 1 & play_or_not == 1 & game_type == 2
tab market if second_mover == 1 & play_or_not == 1 & return_new ==1 & game_type == 2

prtesti 1341 .702 368 .427



*Completion rate
drop if play_or_not == 0
gen send_new = 100
replace send_new = 1 if second_mover == 0
replace send_new = return_new if second_mover == 1
drop if second_mover == 0 & game_type !=1
table market, content (mean send_new)

prtesti 2083 .808 420 .498

clear

*=======*
*Table 3*
*=======*

bysort positive_profit: table role second_mover market, content (mean you_play_or_not n you_play_or_not)

*=======*
*Table 4*
*=======*

bysort positive_profit: table role market if second_mover == 1, content (mean return_new n return_new)

*=======*
*Table 5*
*=======*

set more off
tsset subject period 
gen market_opposite = 0
replace market_opposite = 1 if market == 1


xtlogit you_play_or_not revenue cost i.market_opposite period if second_mover == 0 & positive_profit == 1 & role == 1, re
margins, dydx(*) post
outreg2 using Table5.xls, append ctitle(XTLOGIT IN/OUT pos mover 1 owner) dec(4)

xtlogit you_play_or_not revenue cost i.market_opposite period if second_mover == 0 & positive_profit == 1 & role == 2, re
margins, dydx(*) post
outreg2 using Table5.xls, append ctitle(XTLOGIT IN/OUT pos mover 1 buyer) dec(4)

xtlogit you_play_or_not revenue cost i.market_opposite period if second_mover == 1 & positive_profit == 0 & role == 1, re
margins, dydx(*) post
outreg2 using Table5.xls, append ctitle(XTLOGIT IN/OUT neg mover 2 owner) dec(4)

xtlogit you_play_or_not revenue cost i.market_opposite period if second_mover == 1 & positive_profit == 0 & role == 2, re
margins, dydx(*) post
outreg2 using Table5.xls, append ctitle(XTLOGIT IN/OUT neg mover 2 buyer) dec(4)

xtlogit return_new revenue cost i.market_opposite period if second_mover == 1 & positive_profit == 1 & role == 1, re
margins, dydx(*) post
outreg2 using Table5.xls, append ctitle(XTLOGIT SEND/KEEP pos mover 2 owner) dec(4)

xtlogit return_new revenue cost i.market_opposite period if second_mover == 1 & positive_profit == 1 & role == 2, re
margins, dydx(*) post
outreg2 using Table5.xls, append ctitle(XTLOGIT SEND/KEEP pos mover 2 buyer) dec(4)



*=============*
*Heterogeneity*
*=============*

gen pospro_mover1_in_score=.
replace pospro_mover1_in_score = 1  if you_play_or_not == 1
replace pospro_mover1_in_score = 0  if you_play_or_not == 0
replace pospro_mover1_in_score = . if positive_profit == 0 | second_mover == 1

gen pospro_mover1_subject_temp = 0
replace pospro_mover1_subject_temp = 1 if pospro_mover1_in_score!=.
egen pospro_mover1_subject = max(pospro_mover1_subject_temp), by(subject)

gen negpro_mover2_out_score = .
replace negpro_mover2_out_score = 1  if you_play_or_not == 0
replace negpro_mover2_out_score = 0  if you_play_or_not == 1
replace negpro_mover2_out_score = . if positive_profit == 1 | second_mover == 0

gen negpro_mover2_subject_temp = 0
replace negpro_mover2_subject_temp = 1 if negpro_mover2_out_score !=.
egen negpro_mover2_subject = max (negpro_mover2_subject_temp), by(subject)

gen pospro_mover2_return_score = return_new
replace pospro_mover2_return_score = . if positive_profit == 0

gen pospro_mover2_played_subject_t = 0
replace pospro_mover2_played_subject_t = 1 if pospro_mover2_return_score!=.
egen pospro_mover2_played_subject = max (pospro_mover2_played_subject_t), by(subject)

egen be_trusted_new_subject_t = max (be_trusted_new), by (subject)
gen be_trusted_new_subject = 0
replace be_trusted_new_subject = 1 if be_trusted_new_subject_t!=.

gen have_four_condition = 0
replace have_four_condition = 1 if negpro_mover2_subject == 1 & pospro_mover2_played_subject == 1 & pospro_mover1_subject==1 & be_trusted_new_subject == 1

gen have_three_condition = 0
replace have_three_condition = 1 if negpro_mover2_subject == 1 & pospro_mover2_played_subject == 1 & pospro_mover1_subject==1 

egen no_neg2mover = count(negpro_mover2_out_score), by (subject)
egen no_neg2mover_out = sum (negpro_mover2_out_score), by (subject)

egen no_pos2mover = count(pospro_mover2_return_score), by (subject)
egen no_pos2mover_return = sum (pospro_mover2_return_score), by (subject)

gen sum_negpos2mover = no_neg2mover + no_pos2mover
gen sum_negpos2mover_out_return = no_neg2mover_out + no_pos2mover_return
gen proportion_total = sum_negpos2mover_out_retur / sum_negpos2mover

gen pospro_mover1_in_score_range = .
replace pospro_mover1_in_score_range = 1 if pospro_mover1_in_score <=0.1
replace pospro_mover1_in_score_range = 2 if pospro_mover1_in_score > 0.1 & pospro_mover1_in_score <=0.2
replace pospro_mover1_in_score_range = 3 if pospro_mover1_in_score > 0.2 & pospro_mover1_in_score <=0.3
replace pospro_mover1_in_score_range = 4 if pospro_mover1_in_score > 0.3 & pospro_mover1_in_score <=0.4
replace pospro_mover1_in_score_range = 5 if pospro_mover1_in_score > 0.4 & pospro_mover1_in_score <=0.5
replace pospro_mover1_in_score_range = 6 if pospro_mover1_in_score > 0.5 & pospro_mover1_in_score <=0.6
replace pospro_mover1_in_score_range = 7 if pospro_mover1_in_score > 0.6 & pospro_mover1_in_score <=0.7
replace pospro_mover1_in_score_range = 8 if pospro_mover1_in_score > 0.7 & pospro_mover1_in_score <=0.8
replace pospro_mover1_in_score_range = 9 if pospro_mover1_in_score > 0.8 & pospro_mover1_in_score <=0.9
replace pospro_mover1_in_score_range = 10 if pospro_mover1_in_score > 0.9 & pospro_mover1_in_score <=1

collapse  pospro_mover1_in_score negpro_mover2_out_score pospro_mover2_return_score proportion_total be_trusted_new have_four_condition have_three_condition, by(subject)

spearman pospro_mover1_in_score negpro_mover2_out_score pospro_mover2_return_score be_trusted_new if have_four_condition == 1, star(.05)

clear





*=======================*
*Supplementary materials*
*=======================*

*========*
*Table S1*
*========*

*note that the variable 'role' in this analysis refers to the co-player's role.
drop if play_or_not == 0
gen send_new = 100
replace send_new = 1 if second_mover == 0
replace send_new = return_new if second_mover == 1
drop if second_mover == 0 & game_type !=1
table market price  role , content (mean send_new)

clear

*========*
*Table S2*
*========*

set more off
tsset subject period 
gen market_opposite = 0
replace market_opposite = 1 if market == 1

logit you_play_or_not revenue cost i.market_opposite period if second_mover == 0 & positive_profit == 1 & role == 1, cluster(group)
margins, dydx(*) post
outreg2 using TableS2.xls, append ctitle(logit IN/OUT pos mover 1 owner) dec(4)

logit you_play_or_not revenue cost i.market_opposite period if second_mover == 0 & positive_profit == 1 & role == 2, cluster(group)
margins, dydx(*) post
outreg2 using TableS2.xls, append ctitle(logit IN/OUT pos mover 1 buyer) dec(4)

logit you_play_or_not revenue cost i.market_opposite period if second_mover == 1 & positive_profit == 0 & role == 1, cluster(group)
margins, dydx(*) post
outreg2 using TableS2.xls, append ctitle(logit IN/OUT neg mover 2 owner) dec(4)

logit you_play_or_not revenue cost i.market_opposite period if second_mover == 1 & positive_profit == 0 & role == 2, cluster(group)
margins, dydx(*) post
outreg2 using TableS2.xls, append ctitle(logit IN/OUT neg mover 2 buyer) dec(4)

logit return_new revenue cost i.market_opposite period if second_mover == 1 & positive_profit == 1 & role == 1, cluster(group)
margins, dydx(*) post
outreg2 using TableS2.xls, append ctitle(logit SEND/KEEP pos mover 2 owner) dec(4)

logit return_new revenue cost i.market_opposite period if second_mover == 1 & positive_profit == 1 & role == 2, cluster(group)
margins, dydx(*) post
outreg2 using TableS2.xls, append ctitle(logit SEND/KEEP pos mover 2 buyer) dec(4)


*=========*
*Table S3a*
*=========*

table second_mover stage role if profit >0, content (mean you_play_or_not n you_play_or_not)
table second_mover stage role if profit <0, content (mean you_play_or_not n you_play_or_not)

*=========*
*Table S3b*
*=========*

table second_mover stage role if profit >0, content (mean return_new n return_new)
table second_mover stage role if profit <0, content (mean return_new n return_new)


